<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='https://cdn.staticfile.org/react/16.4.0/umd/react.development.js'></script>
    <script src='https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js'></script>
    <!-- 生产环境中不建议使用 -->
    <script src='https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js'></script>
    <!-- PropTypes文件 -->
    <script src='https://unpkg.com/prop-types@15.6.2/prop-types.js'></script>
</head>

<body>
    <div id='app'>
    </div>
    <script type='text/babel'>
        //所谓非受控组件，就是现用现取

        class Demo extends React.Component{

            // 像这种现用现取的就是非受控组件
            handleSubmit = (e)=>{
                e.preventDefault()
                console.log(this.input1.value)
            }

            render(){
                return (
                    <form onSubmit={this.handleSubmit}>
                        姓名: <input type="text" name="username" ref={node=>this.input1 = node}/>
                        <input type="submit" value="提交"/>
                    </form>
                )
            }
        }

        ReactDOM.render(<Demo/>,document.getElementById('app'))
    </script>
</body>

</html>